package com.example.springboot.config;

import org.mitre.dsmiley.httpproxy.ProxyServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.Servlet;

@Configuration
public class ProxyServletConfiguration {

    @Bean
    public ServletRegistrationBean proxyServletRegistration() {
        ServletRegistrationBean<TileProxyServlet> registrationBean = new ServletRegistrationBean<>(new TileProxyServlet(), "/*");
        registrationBean.addInitParameter(TileProxyServlet.P_LOG, "true");
        registrationBean.addInitParameter(TileProxyServlet.P_TARGET_URI, "");
        return registrationBean;
    }
}
